import pandas as pd
import time
import math
file_path = 'data/相亲对象.csv'
persons = pd.read_csv(file_path,encoding='gbk')
print(persons)

#
age = 29#男性年龄29想找一个年龄差距4岁以内的
high = 170 #男性身高170 身高差在8厘米以内
study = '博士'
curr_year = time.localtime(time.time()).tm_year
nameList = ['姓名','出生日期','身高','学历','长相']
persons_conditions = persons.loc[:,nameList]
keyList = list(range(5))
dictName = dict(zip(nameList,keyList))
print(dictName.get('学历'))
studydict = {'博士':5,'研究生':4,'本科':3,'大专':2,'高中':1,'初中':0}
print(persons_conditions)

#for condition in persons_conditions.values:
   #print(condition[1])

conditions_cover = [
    int(math.fabs(age - (curr_year - time.strptime(condition[dictName.get('出生日期')],'%Y-%m-%d').tm_year)) <=2) +
    int(math.fabs(high - condition[dictName.get('身高')])  <=8) +
    int(studydict.get(condition[dictName.get('学历')]) >= studydict.get('研究生')) +
    int(ord(condition[dictName.get('长相')]) <= ord('A')) >= 2
             for condition in persons_conditions.values]
print(conditions_cover)



